/*
 * Copyright 2012-2020 the original author or authors.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * @author lzhoumail@126.com/zhouli
 * Git http://git.oschina.net/zhou666/spring-cloud-7simple
 */

package com.pretty.cloud;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableDiscoveryClient
//@EnableCircuitBreaker
//@EnableFeignClients
public class CloudService {
    @Autowired
    void setEnviroment(Environment env) {
        System.out.println("mysqldb.datasource.url from env: "
                + env.getProperty("from"));
    }

    public static void main(String[] args) throws Exception {
        SpringApplication.run(CloudService.class, args);
    }

    @LoadBalanced
    @Bean
    RestTemplate restTemplate() {
        return new RestTemplate();
    }

//	@Bean
//	@Scope("prototype")
//	public Feign.Builder feignBuilder() {
//		return Feign.builder();
//	}
//
//	@Bean
//	public Logger.Level feignLogger() {
//		return Logger.Level.FULL;
//	}
//
//	private static final int FIVE_SECONDS = 5000;
//
//	@Bean
//	public Request.Options options() {
//		return new Request.Options(FIVE_SECONDS, FIVE_SECONDS);
//	}

}
